from coin.exchange.base.kr_rest.py_product import PyProduct
from coin.exchange.base.kr_rest.product_info import (
    ProductInfo, ProductHolder, ProductInfoConstant)
from coin.exchange.huobi.kr_rest.product_info import huobi_product_info
from coin.exchange.huobi_futures.kr_rest.constants import futures_pi_file
from coin.exchange.huobi.kr_rest.currency import HuobiCurrency
from coin.exchange.huobi_futures.kr_rest.futures_product import HuobiFuturesProduct


huobi_futures_product_info = ProductInfoConstant(futures_pi_file)

def get_holder_from_product(product):
  if isinstance(product, PyProduct):
    assert product.market_name == 'Futures' and product.exchange_name == 'Huobi'
  else:
    assert isinstance(product, HuobiFuturesProduct)
  product_info = huobi_product_info.get_product_info(product.relative_norm)
  return ProductHolder(product, product_info)
